#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
int GetMonthDay(int year, int month)
{
    int monthday[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    if ((((year % 4 == 0) && (year % 100 != 0)) || year % 400 == 0) && month == 2)
    {
        return 29;
    }
    return monthday[month];
}
int main()
{
    int year, day;
    int month = 1;
    int reday = 0;
    while (scanf("%d %d", &year, &day) != EOF)
    {
        month = 1;
        while (day > GetMonthDay(year, month))
        {
            day -= GetMonthDay(year, month);
            ++month;
        }
        printf("%04d-%02d-%02d\n", year, month, day);
    }
    return 0;
     

}////